package edu.example;
import java.util.TreeMap;
import java.util.Vector;


public class Reviewer 
{

	private TreeMap<String, String> data;
	
	private String EMailAddress;
	private String HomeCountry1;
	private String HomeCountry2;
	private String Name;
	private String Password;
	private String ResearchArea1;
	private String ResearchArea2;
	private String ResearchArea3;
	private boolean chairCheck;
	private int NumAssignedReviews;
	private boolean Available;
	private float Workload;
	private int CompletedReview;
	
	private Review currentReview;
	private Application currentApp;
	 
	public Reviewer( String initEmail, String initName, String initPassword, boolean initChair) {
		EMailAddress = initEmail;
		Name = initName;
		Password = initPassword;
		chairCheck = initChair;
		HomeCountry1 = "";
		HomeCountry2 = "";
		ResearchArea1 = "";
		ResearchArea2 = "";
		ResearchArea3 = "";
		NumAssignedReviews = 0;
		Available = true;
		Workload = 1;
		CompletedReview = 0;
		currentReview = null;
		currentApp = null;
	}
	
	public Reviewer(Vector<String> initreader){
		Name=initreader.get(0);
		String chairchair;
		chairchair=initreader.get(1);
		if(chairchair.equals("chair"))
			chairCheck=true;
		Password=initreader.get(2);
		EMailAddress=initreader.get(3);
		HomeCountry1 = initreader.get(4);
		HomeCountry2 = initreader.get(5);
		ResearchArea1 =initreader.get(6);
		ResearchArea2 = initreader.get(7);
		ResearchArea3 = initreader.get(8);
		NumAssignedReviews = Integer.parseInt(initreader.get(9));
		Available = Boolean.parseBoolean(initreader.get(10));
		Workload = Float.parseFloat(initreader.get(11));
		CompletedReview = Integer.parseInt(initreader.get(12));
		currentReview = null;
		currentApp = null;
	}
	 
	//Accessors
	public String getEMailAddress()  		     {return EMailAddress;}
	public String getName()              		 {return Name;}
	public String getHomeCountry1()       {return HomeCountry1;}
	public String getHomeCountry2()       {return HomeCountry2;}
	public String getPassword()        		 	 {return Password;}
	public String getResearchArea1()      {return ResearchArea1;}
	public String getResearchArea2()      {return ResearchArea2;}
	public String getResearchArea3()      {return ResearchArea3;}
	public boolean getChairCheck()				 {return chairCheck;}
		 
	public int getNumAssignedReviews()   {return NumAssignedReviews;}
	public int getCompletedReview()      {return CompletedReview;}
	public boolean getAvailable()        {return Available;}
	public float getWorkload()           {return Workload;}
	
	
	public Review getCurrentReview() 	 {return currentReview;}
	public Application getCurrentApp()	 {return currentApp;}
	 
    //Mutators
	public void setEMailAddress(String newEmail)        		{EMailAddress = newEmail;}
	public void setName(String newName)                 		{Name = newName;}
	public void setHomeCountry1(String newHomeCountry)   {HomeCountry1 = newHomeCountry;}
	public void setHomeCountry2(String newHomeCountry)   {HomeCountry2 = newHomeCountry;}
	public void setPassword(String newPassword)         		{Password = newPassword;}
	public void setResearchArea1(String newResearchArea) {ResearchArea1 = newResearchArea;}
	public void setResearchArea2(String newResearchArea) {ResearchArea2 = newResearchArea;}
	public void setResearchArea3(String newResearchArea) {ResearchArea3 = newResearchArea;}
	public void setNumAssignedReviews(int newNum)       {NumAssignedReviews += newNum;}
	public void setCompletedReview(int newComp)         {CompletedReview = newComp;}
	public void setAvailable(boolean newAvai)           {Available = newAvai;}
	public void setWorkload(float newWorkload)          {Workload = newWorkload;}
	
	public void setCurrentApp(Application initApp)		{currentApp = initApp;}
	 
	public Review writeReview(){
		currentReview = new Review(this, currentApp);
		CompletedReview++;
		return currentReview;
	}
	
	public String toString(){
		String s = "";
		s+= "Name: "+getName()+"\n";
		s+= "Password: "+getPassword()+"\n";
		s+= "E-Mail: "+getEMailAddress()+"\n";
		s+= "Number of Assigned Reviews: "+getNumAssignedReviews()+"\n";
		s+= "Available: "+getAvailable()+"\n";
		s+= "Workload: "+getWorkload()+"\n";
		return s;
		
	}
	
}
